<#if packageStr ?? && packageStr!=''>
package ${packageStr};
</#if>
import ${generatedMap[classInfo.firstUpperName]};
import ${generatedMap[classInfo.firstUpperName+"Service"]};
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSON;
import com.yunliuchain.examination.common.req.QueryReq;
import com.yunliuchain.examination.common.controller.CommonController;
import com.yunliuchain.examination.common.res.ApiResult;
import com.yunliuchain.examination.common.res.PageList;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
        import io.swagger.annotations.Api;
import java.util.HashMap;

/**<p>Title:<#if classInfo.remarks?? && classInfo.remarks!=''>${classInfo.remarks}<#else>${classInfo.firstUpperName?default(classInfo.firstUpperName)}</#if> 控制器 </p>
 * <p>Description: </p>
 * <p>作者：${author}</p>
 * <p>日期：${datetime}</p>
 * <p>版本：1.0</p>
 */
@RestController
@RequestMapping("/yunbandan/admin/${classInfo.moduleGroup}/${classInfo.className}")
@Api(description = "${classInfo.remarks}接口")
public class ${classInfo.firstUpperName}Controller extends CommonController {
    private final Logger logger = Logger.getLogger(getClass());

    @Autowired
    private ${classInfo.firstUpperName}Service ${classInfo.className}Service;


    /**
     * 查询单条记录
     * @param id
     * @return ApiResult
     */
    @Override
    public ApiResult get(@PathVariable Long id) {
        return ${classInfo.className}Service.get(id);
    }


    /**
     * 保存
     * @param json
     * @return ApiResult
     */
    @Override
    public ApiResult save(@RequestBody String json) {
        return ${classInfo.className}Service.save(JSON.parseObject(json, ${classInfo.firstUpperName}.class));
    }


    /**
     * 更新
     * @param json
     * @return ApiResult
     */
    @Override
    public ApiResult update(@RequestBody String json) {
       return ${classInfo.className}Service.update(JSON.parseObject(json, ${classInfo.firstUpperName}.class));
    }


    /**
     * 批量删除
     * @param json
     * @return ApiResult
     */
    @Override
    public ApiResult delByIds(@RequestBody String json) {
       return  ${classInfo.className}Service.delByIds(JSONArray.parseArray(json,Long.class));
    }

    /**
     * 分页列表查询
     * @param json
     * @return ApiResult
     */
    @Override
    public ApiResult pageList(@RequestBody(required = false) String json) {
        logger.debug("${classInfo.className} pageList: "+ json);
        QueryReq queryReq = buildQueryReq(json);
        PageList<${classInfo.firstUpperName}> pageList = ${classInfo.className}Service.pageList(queryReq);
        return ApiResult.success(pageList);
    }
}
